---
layout: "default"
title: "SequenceOf"
description: "Swift documentation for 'SequenceOf': A type-erased sequence."
keywords: "SequenceOf,struct,swift,documentation,generate,Generator,Element"
root: "/v1.2"
---

<div class="intro-declaration"><code class="language-swift">struct SequenceOf&lt;T&gt;</code></div>

<div class="discussion comment">
    <p>A type-erased sequence.</p>

<p>Forwards operations to an arbitrary underlying sequence with the
same <code>Element</code> type, hiding the specifics of the underlying
sequence type.</p>

<p>See also: <code>GeneratorOf&lt;T&gt;</code>.</p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<code class="inherits">SequenceType, _SequenceType, _Sequence_Type</code>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>

<tr>
<th id="aliases">Associated Types</th>
<td>
<span id="aliasesmark"></span>
<div class="declaration">
<code class="language-swift">Generator = GeneratorOf&lt;T&gt;</code>
<div class="comment">
    <p><em>Type alias inferred.</em></p>
</div>
</div>
<div class="declaration">
<code class="language-swift">Element = Generator.Element</code>
<div class="comment">
    <p><em>Type alias inferred.</em></p>
</div>
</div>
</td>
</tr>


<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>


<h3>Initializers</h3>
<div class="declaration" id="init-s_-sequencetype-where-t-t_-s">
<a class="toggle-link" data-toggle="collapse" href="#comment-init-s_-sequencetype-where-t-t_-s"><wbr>init&lt;S : SequenceType where T == T&gt;(<wbr>_: S)</a><div class="comment collapse" id="comment-init-s_-sequencetype-where-t-t_-s"><div class="p">
    <p>Construct an instance whose <code>generate()</code> method forwards to
that of <code>base</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init&lt;S : SequenceType where T == T&gt;(_ base: S)</code>

    </div></div>
</div>
<div class="declaration" id="init-g_-generatortype-where-t-t_-g">
<a class="toggle-link" data-toggle="collapse" href="#comment-init-g_-generatortype-where-t-t_-g"><wbr>init&lt;G : GeneratorType where T == T&gt;(<wbr>_: () -&gt; G)</a><div class="comment collapse" id="comment-init-g_-generatortype-where-t-t_-g"><div class="p">
    <p>Construct an instance whose <code>generate()</code> method forwards to
<code>makeUnderlyingGenerator</code></p>

    <h4>Declaration</h4>    
    <code class="language-swift">init&lt;G : GeneratorType where T == T&gt;(_ makeUnderlyingGenerator: () -&gt; G)</code>

    </div></div>
</div>





<h3>Instance Methods</h3>
<div class="declaration" id="func-generate">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-generate">func generate()</a>
        
<div class="comment collapse" id="comment-func-generate"><div class="p">
    <p>Return a <em>generator</em> over the elements of this <em>sequence</em>.</p>

<p>Complexity: O(1)</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func generate() -&gt; GeneratorOf&lt;T&gt;</code>
    
    
</div></div>
</div>


